import { Injectable } from '@angular/core';
import { Account } from '../domain/account'
import { Http ,Response} from '@angular/http';
import { Authority } from '../domain/authority'

import 'rxjs/add/operator/toPromise';


@Injectable()
export class AccountService {

    constructor(private http:Http) { }

    getAccountList(){
        return this.http.get('../../assets/mock-data/accountList.json')
        .toPromise()
        .then(res => <Account[]>res.json().data)
        .then(data => { return data; });
    }
    getAuthorityList(){
        return this.http.get('../../assets/mock-data/authorityList.json')
        .toPromise()
        .then(res => <Authority[]>res.json().data)
        .then(data => { return data; });
    }
}